local more1__moshi = fk.CreateSkill {
  name = "more1__moshi",
  tags = { Skill.Combo },
}

Fk:loadTranslationTable{
  ["more1__moshi"] = "默识",
  [":more1__moshi"] = "连招技（基本牌+锦囊牌），你可以令此牌额外结算两次；若此牌目标唯一，则你可令一名不为此牌目标的合法角色也成为此牌目标。",

  ["#more1__moshi-invoke"] = "默识：是否令此 %arg 额外结算两次，",
  ["#more1__moshi-choose"] = "默识：选择一名角色成为 %arg 的目标",

  ["$more1__moshi1"] = "日暮飞伯劳，倦梳头，坐看鸥鹭争舟。",
  ["$more1__moshi2"] = "姊折翠柳寄江北，念君心悠悠。"
}

more1__moshi:addEffect(fk.CardUsing, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(more1__moshi.name) and data.card.type == Card.TypeTrick and
      data.extra_data and data.extra_data.combo_skill and data.extra_data.combo_skill[more1__moshi.name]
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {
      skill_name = more1__moshi.name,
      prompt = "#more1__moshi-invoke:::"..data.card.name,
    })
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    room:setPlayerMark(player, more1__moshi.name, 0)
    data.additionalEffect = (data.additionalEffect or 0) + 2
    if #data.tos == 1 and #data:getExtraTargets() > 0 then 
      local to = room:askToChoosePlayers(player, {
        min_num = 1,
        max_num = 1,
        targets = data:getExtraTargets(),
        skill_name = more1__moshi.name,
        prompt = "#more1__moshi-choose",
        cancelable = true,
      })
      if #to > 0 then
        for _, p in pairs(to) do
          data:addTarget(p)
        end
      end
    end
  end,
})

more1__moshi:addEffect(fk.AfterCardUseDeclared, {
  can_refresh = function (self, event, target, player, data)
    return target == player and player:hasSkill(more1__moshi.name, true)
  end,
  on_refresh = function (self, event, target, player, data)
    local room = player.room
    if data.card.type == Card.TypeBasic then
      room:setPlayerMark(player, more1__moshi.name, 1)
    elseif player:getMark(more1__moshi.name) > 0 and data.card.type == Card.TypeTrick then
        data.extra_data = data.extra_data or {}
        data.extra_data.combo_skill = data.extra_data.combo_skill or {}
        data.extra_data.combo_skill[more1__moshi.name] = true
    else
      room:setPlayerMark(player, more1__moshi.name, 0)
    end
  end,
})

return more1__moshi
